using Framework.Utility.ViewModels;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using MonitorCode.DBCode;
using MonitorCode.NPS;

namespace UnitTest
{
    public class Test_DBFactory
    {  
        private INPSService _npsService ;
        [SetUp]
        public void Setup()
        {
            _npsService = new NPSService(null);
        }
        [Test]
        public void TestCountBySql()
        {
            //DBConnModel dBConnModel = new DBConnModel();
            //dBConnModel.DBType = "SqlServer";
            //dBConnModel.DBHostName = "localhost";
            //dBConnModel.DatabaseName = "DH";
            //dBConnModel.UserName = "sa";
            //dBConnModel.Password = "2023@ldh";

            DBLinkModel dB2 = new DBLinkModel();
            dB2.DBType = "MySql";
            dB2.DBHostName = "127.0.0.1";
            dB2.DatabaseName = "ldh";
            dB2.UserName = "root";
            dB2.Password = "123456";
            dB2.Port = 3306;
            string sql = "select 1 from biz_book";
            var dbService = new DBFactory(dB2).DBService();
            var result = dbService.GetCountBySql(sql);

        }
        [Test]
        public void TestListBySql()
        {
            //DBConnModel dBConnModel = new DBConnModel();
            //dBConnModel.DBType = "SqlServer";
            //dBConnModel.DBHostName = "localhost";
            //dBConnModel.DatabaseName = "DH";
            //dBConnModel.UserName = "sa";
            //dBConnModel.Password = "2023@ldh";

            DBLinkModel dB2 = new DBLinkModel();
            dB2.DBType = "MySql";
            dB2.DBHostName = "127.0.0.1";
            dB2.DatabaseName = "ldh";
            dB2.UserName = "root";
            dB2.Password = "123456";
            dB2.Port = 3306;
            string sql = "select * from biz_book"; 
            var dbService = new DBFactory(dB2).DBService(); 
            var  result = dbService.GetListBySql<Biz_Book>(sql); 
 
        }
    }
}